namespace CSharpPro._1021;

public class Student
{
    //字段
    private int id { set; get; }
    private string name { set; get; }
    private string userEmail { set; get; }
    
    //属性
    public int Id
    {
        get
        {
            return id;
        }
        set
        {
            if (value < 100)
            {
                id = value;
            }
        }
    }
    public string Name
    {
        get
        {
            return name;
        }
        set
        {
            if (value != null)
            {
                name = value;
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
    }
    
    public string UserEmail
    {
        get => userEmail;
        set => userEmail = value?? throw new ArgumentNullException();
    }
    
    public override string ToString()
    {
        return $"id:{id},name:{name},userEmail:{userEmail}";
    }
    
    public Student(int id, string name, string userEmail)
    {
        this.id = id;
        this.name = name;
        this.userEmail = userEmail;
    }
    public Student(int id, string name)
    {
        this.id = id;
        this.name = name;
    }

    public Student()
    {
        
    }

    public int getId()
    {
        return id;
    }
}